// pages/bill/bill.js
var config = require("../../utils/config.js");
var network = require("../../utils/network.js");
var date=require("../../utils/util.js")
Page({
  /**
   * 页面的初始数据
   */
  data: {
    date:'',//日期
    bill:[] //消费数据
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      date: date.getCurrentToday()
    })
    this.getBill();
  },
  bindDateChange: function (e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      date: e.detail.value
    })
    this.getBill();
  },
  getBill:function(){
    wx.request({
      url: config.host +'api_word/consumption',
      method:"POST",
      data:{start_time:this.data.date},
      success:res=>{
        console.log(res.data.data)
        if(res.data.code==99){
          this.setData({
            bill:res.data.data
          })
        }
      }
    })
  },

  onPullDownRefresh: function () {
  
  },
  onShareAppMessage: function () {

 

  }
})